﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using Finance.UI.ViewModels;

namespace Finance.UI.UserControls
{
    public partial class CycleSummaryUserControl : UserControl
    {
        public string TopicContent { get; set; }
        public string CycleContent { get; set; }
        public event EventHandler Click;

        public CycleSummaryUserControl()
        {
            InitializeComponent();
            this.Loaded += (o, e) => { InitializeDataContext(); };
        }

        private void InitializeDataContext()
        {
            var R = new Random();
            CycleSummaryViewModel dataContext = new CycleSummaryViewModel(
                this.CycleContent ?? "Unknown");
            dataContext.IconUri = new Uri("ApplicationIcon.png", UriKind.RelativeOrAbsolute);
            dataContext.Income = R.Next(0, 10000);
            dataContext.Payout = R.Next(0, 10000);

            this.DataContext = dataContext;
        }

        private void LinkToPeriodicDetails_Click(object sender, RoutedEventArgs e)
        {
            this.Click(sender, e);
        }
    }
}
